<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - animation-duration: inherit</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#the-animation-duration-property-">
   <meta name="flags" content="dom">
   <meta name="assert" content="The computed value of 'animation-duration' is
   the same as the specified value">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes grow {
         from {
            width: 100px;
         }
         to {
            width: 200px;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: red;
      }
      div > div {
         background: blue;
         animation-duration: inherit;
      }
      .test {
         animation-duration: 1s;
      }
      .test, .test > div {
         animation-name: grow;
         animation-fill-mode: forwards;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var divs = document.querySelectorAll('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var timeout = setTimeout(function() {
            test(function(){assert_true(false);}, testName); done();
            log.data = 'FAIL';
         }, 1500);
         divs[1].addEventListener('animationend', function() {
            clearTimeout(timeout);
            var style = getComputedStyle(divs[1], null);
            passed = (style.getPropertyValue('animation-duration') == '1s');
            test(function(){assert_true(passed);}, testName); done();
            log.data = (passed ? 'PASS if the animation occurred.' : 'FAIL');
         });
         divs[0].className = 'test';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The blue square below should grow to a rectangle twice as wide, and there
   should be no red.</p>
   <p>Testing...</p>
   <div>
      <div></div>
   </div>
</body>
</html>
